import { reqCategoryList } from "@/api";

const state = {
    categoryList: [],
};

const getters = {};

const mutations = {
    // 获取三级列表
    GET_CATEGORIES(state, { categoryList }) {
        state.categoryList = categoryList;
    },
};

const actions = {
    // 获取三级列表
    getCategoryList({ commit }) {
        reqCategoryList().then(response => {
            commit("GET_CATEGORIES", { categoryList: response });
        });
    },
};

export default {
    namespaced: true, // 开启命名空间
    state,
    getters,
    mutations,
    actions,
};
